package com.inns.position.hbase.bean;

import java.util.Map;
import java.util.Set;

public class StatisticsResult {

    private String groupKey;
    private int count;
    private long sum;
    private Map<String, Set<String>> distinctValues;
    private Map<String, Integer> countMap;

    public String getGroupKey() {
        return groupKey;
    }

    public void setGroupKey(String groupKey) {
        this.groupKey = groupKey;
    }

    public String getSubKey(int index) {
        String[] strings = this.groupKey.split("\\|");
        if (strings.length > index) {
            return strings[index];
        }
        return "";
    }

    public static String getSubKey(String str, int index) {
        StatisticsResult statisticsResult = new StatisticsResult();
        statisticsResult.setGroupKey(str);
        return statisticsResult.getSubKey(index);
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public void increaseCount() {
        this.count += 1;
    }

    public long getSum() {
        return sum;
    }

    public void setSum(long sum) {
        this.sum = sum;
    }

    public void addSum(long increment) {
        this.sum += increment;
    }

    public Map<String, Set<String>> getDistinctValues() {
        return distinctValues;
    }

    public void setDistinctValues(Map<String, Set<String>> distinctValues) {
        this.distinctValues = distinctValues;
    }

    public Map<String, Integer> getCountMap() {
        return countMap;
    }

    public void setCountMap(Map<String, Integer> countMap) {
        this.countMap = countMap;
    }

    @Override
    public String toString() {
        return groupKey + "-->count=" + count + ",sum=" + sum + ",distinctValues=" + distinctValues + ",countMap=" + countMap;
    }
}
